<template>
  <a-card :loading="loading" :body-style="{ padding: '20px 24px 8px' }" :bordered="false">
    <div class="chart-card-header">
      <div class="meta">
        <span class="chart-card-title">{{ title }}</span>
        <span class="chart-card-action">
          <slot name="action"></slot>
        </span>
      </div>
    </div>
    <div class="chart-card-content">
      <slot></slot>
    </div>
    <div class="chart-card-footer">
      <slot name="footer"></slot>
    </div>
  </a-card>
</template>

<script>
export default {
  name: 'ChartCard',
  props: {
    title: {
      type: String,
      default: ''
    },
    total: {
      type: String,
      default: ''
    },
    loading: {
      type: Boolean,
      default: false
    }
  }
}
</script>

<style lang="less" scoped>
.chart-card-header {
  .meta {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-bottom: 20px;
    font-size: 20px;
    border-bottom: 1px solid #e8e8e8;
    color: rgba(0, 0, 0, 0.45);
    font-size: 16px;
    line-height: 22px;

    .chart-card-title {
      font-weight: 700;
    }
  }
}

.chart-card-action {
  cursor: pointer;
  position: absolute;
  top: 0;
  right: 0;
}

.chart-card-footer {
  border-top: 1px solid #e8e8e8;
  padding-top: 9px;
  margin-top: 8px;
}

.chart-card-content {
  padding: 12px 0;
  position: relative;
  height: 118px;
  width: 100%;
}
</style>

